﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt.redshift
{
	// Token: 0x02000101 RID: 257
	public class TRedshiftAlterSchema : TCustomSqlStatement
	{
		// Token: 0x17000176 RID: 374
		// (get) Token: 0x06000874 RID: 2164 RVA: 0x003020BA File Offset: 0x003002BA
		// (set) Token: 0x06000875 RID: 2165 RVA: 0x003020C2 File Offset: 0x003002C2
		public virtual EAlterSchema AlterSchemaType
		{
			get
			{
				return this.alterSchemaType;
			}
			set
			{
				this.alterSchemaType = value;
			}
		}

		// Token: 0x17000177 RID: 375
		// (get) Token: 0x06000876 RID: 2166 RVA: 0x003020CB File Offset: 0x003002CB
		// (set) Token: 0x06000877 RID: 2167 RVA: 0x003020D3 File Offset: 0x003002D3
		public virtual TObjectName SchemaName
		{
			get
			{
				return this.schemaName;
			}
			set
			{
				this.schemaName = value;
			}
		}

		// Token: 0x17000178 RID: 376
		// (get) Token: 0x06000878 RID: 2168 RVA: 0x003020DC File Offset: 0x003002DC
		// (set) Token: 0x06000879 RID: 2169 RVA: 0x003020E4 File Offset: 0x003002E4
		public virtual TObjectName NewSchemaName
		{
			get
			{
				return this.newSchemaName;
			}
			set
			{
				this.newSchemaName = value;
			}
		}

		// Token: 0x17000179 RID: 377
		// (get) Token: 0x0600087A RID: 2170 RVA: 0x003020ED File Offset: 0x003002ED
		// (set) Token: 0x0600087B RID: 2171 RVA: 0x003020F5 File Offset: 0x003002F5
		public virtual TObjectName OwnerName
		{
			get
			{
				return this.ownerName;
			}
			set
			{
				this.ownerName = value;
			}
		}

		// Token: 0x0600087C RID: 2172 RVA: 0x003020FE File Offset: 0x003002FE
		public TRedshiftAlterSchema(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstredshiftAlterSchema;
		}

		// Token: 0x0600087D RID: 2173 RVA: 0x00302114 File Offset: 0x00300314
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			base.doParseStatement(psql);
			TDummy tdummy = (TDummy)this.rootNode;
			this.schemaName = (TObjectName)tdummy.node1;
			int @int = tdummy.int1;
			if (@int != 1)
			{
				if (@int == 2)
				{
					this.alterSchemaType = EAlterSchema.easOwnerTo;
					this.ownerName = (TObjectName)tdummy.node2;
				}
			}
			else
			{
				this.alterSchemaType = EAlterSchema.easRenameTo;
				this.newSchemaName = (TObjectName)tdummy.node2;
			}
			return 0;
		}

		// Token: 0x0600087E RID: 2174 RVA: 0x00302194 File Offset: 0x00300394
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x0600087F RID: 2175 RVA: 0x003021A4 File Offset: 0x003003A4
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x04001216 RID: 4630
		private EAlterSchema alterSchemaType;

		// Token: 0x04001217 RID: 4631
		private TObjectName schemaName;

		// Token: 0x04001218 RID: 4632
		private TObjectName newSchemaName;

		// Token: 0x04001219 RID: 4633
		private TObjectName ownerName;
	}
}
